@ECHO OFF

SETLOCAL

SET SZEXE=7za.exe

rem COPY "%~dp0..\Sample.Contracts\ContractsMapping.xsd" "%~dp0..\Files\Max Generated Contracts Library"
rem COPY "%~dp0..\Sample.Contracts\ContractType.tt" "%~dp0..\Files\Max Generated Contracts Library"
rem COPY "%~dp0..\Sample.Contracts\ContractType_IEntityWithKey.tt" "%~dp0..\Files\Max Generated Contracts Library"
rem COPY "%~dp0..\Sample.Contracts\ContractType_ObjectOverrides.tt" "%~dp0..\Files\Max Generated Contracts Library"
rem COPY "%~dp0..\Sample.Contracts\EnumType.tt" "%~dp0..\Files\Max Generated Contracts Library"

CALL :MakeZip "Max Generated Contracts Library"

rem COPY "%~dp0..\Sample.WcfService\Mapper.tt" "%~dp0..\Files\Max Mapper Generator Templates Set"
rem COPY "%~dp0..\Sample.WcfService\ReverseMapper.tt" "%~dp0..\Files\Max Mapper Generator Templates Set"
rem COPY "%~dp0..\Sample.WcfService\Mapper_Get~SourcePropertyName.tt" "%~dp0..\Files\Max Mapper Generator Templates Set"
rem COPY "%~dp0..\Sample.WcfService\SelectProjections.tt" "%~dp0..\Files\Max Mapper Generator Templates Set"

CALL :MakeZip "Max Mapper Generator Templates Set"

CALL :MakeZip "Max Empty Master Generation Template"

CALL :MakeZip "Max Empty SubTemplate"

CALL :MakeZip "Max IEntityWithKey Contracts Template"

CALL :MakeZip "Max IExtensibleDataObject Contracts Template"

CALL :MakeZip "Max GetSourcePropertyName Mapper Template"

CALL :MakeZip "Max Select Projections Mapper Template"

CALL :MakeZip "Max Identifier Based ObjectSource Mapper Template"

CALL :MakeZip "Max Model Validation Contracts Template"

CALL :MakeZip "Max StringConverter Contracts Template"
EXIT /B 0


:MakeZip
TF checkout "%~dp0..\Files\%~1.zip"
DEL "%~dp0..\Files\%~1.zip"
"%SZEXE%" a -r -tzip "%~dp0..\Files\%~1.zip" "%~dp0..\Files\%~1\*"
EXIT /B 0